<style rel="stylesheet/scss" lang="scss">

</style>

<template>
    <div class="nav">
        <div class="logo"><img :src="logoUrl"/></div>
        <el-row>
            <el-col :span="24">
                <div class="grid-content bg-blue-dark">
                    <div class="navTop">
                        <div class="titleLeft">{{$store.state.title}}</div>
                        <div class="titleRight">
                            <p><span>当前账户：</span><span>{{userName}}</span></p>
                            <div class="exitBox" @click="nav_exit">
                                <img class="titleExit" :src="exitUrl"/>
                                <img class="titleExitActive" :src="exitUrlActive"/>
                            </div>
                        </div>
                    </div>
                </div>
            </el-col>
        </el-row>
    </div>
</template>

<script>
    export default {
        name: 'adverHeader',
        props: {
            userInfo: {
                type: Object,
                default: () => {
                    return {};
                }
            }
        },
        data() {
            return {
                logoUrl: require('assets/logo_title.png'),
                touXiangUrl: require('assets/touxiang.png'),
                exitUrl: require('assets/tuichu.png'),
                exitUrlActive: require('assets/tuichuActive.png'),
                userName: ''
            };
        },
        created() {
            this.userName = sessionStorage.userName;
        },
        methods: {
            nav_exit() {
                sessionStorage.clear();
                this.set_storage('url', this.$router.currentRoute.path);
                this.$router.push({path: '/login'});
            }
        }
    };
</script>
